<script type="text/javascript">
    if (window.history) {
            function noBack(){window.history.forward()}
            noBack();
            window.onload=noBack;
            window.onpageshow=function(evt){if(evt.persisted)noBack()}
            window.onunload=function(){void(0)}
    }
	
	function showFields(valor){
        if (valor == 3 || valor == 6) {
            document.getElementById('divout').style.display='none';
        }else{
            document.getElementById('divout').style.display='block';
        }
    }
	function showFields2(valor){
        if (valor == 0) {
            document.getElementById('divout2').style.display='none';
        }else{
            document.getElementById('divout2').style.display='block';
        }
    }
	
	function showFields_dominio_completo(valor){
        if (valor == 2 || valor == 3) {
            document.getElementById('dominio_completo').style.display='none';
            document.searchform.VehiclesDominio.value = "";
        }else{
            document.getElementById('dominio_completo').style.display='block';
        }
    }
	function showFields_motor_completo(valor){
        if (valor == 2 || valor == 3) {
            document.getElementById('motor_completo').style.display='none';
            document.searchform.VehiclesNroMotor.value = "";
        }else{
            document.getElementById('motor_completo').style.display='block';
        }
    }
	function showFields_chasis_completo(valor){
        if (valor == 2 || valor == 3) {
            document.getElementById('chasis_completo').style.display='none';
            document.searchform.VehiclesNroChasis.value = ""; 
        }else{
            document.getElementById('chasis_completo').style.display='block';
        }
    }
    </script>
<div class="masters form">
<?php $this->Html->script('prototype', array('inline' => false));?>
<?php echo $this->Form->create('Searches',array('url'=>array('controller'=>'searches','action'=>'index'),'name'=>'searchform'));?>
	<h4 style="margin-top: 0px; margin-bottom: 8px;"><legend><?php __('Búsquedas'); ?></legend></h4>
	<fieldset>
		<div style=" margin-left:0px; width: 1000px; ">
		<div style="padding-left:10px; padding-top:1px; width: 500px; float:left;">
            <fieldset>
                            <h5 style="margin-top: 0px; margin-bottom: 8px;"><legend><?php __('Número de registro'); ?></legend></h5>
			<br/>
				<fieldset>
				<legend><?php __('Nro DNFDA'); ?></legend>
				<?php echo $this->Form->input('Master.ids',array('label'=>'DNFDA','MaxLength'=>'10','style' => 'width:50px;')); ?>
               
				</fieldset>
<!--                    *******************************************************************    -->
            <h5 style="margin-top: 0px; margin-bottom: 8px;"><legend><?php __('Vehiculo'); ?></legend></h5>
			<br/>
				<fieldset>
				<legend><?php __('Fecha de Secuestro'); ?></legend>
				<?php echo $this->Form->input('Master.fecha_desde',array('dateFormat' => 'DMY','label'=>'Desde','type'=>'date','empty'=>'-', 'tabindex' =>'1', 'maxYear' => (date('Y') - 0)));?>
                <?php echo $this->Form->input('Master.fecha_hasta',array('dateFormat' => 'DMY','label'=>'Hasta','type'=>'date','empty'=>'-', 'tabindex' =>'2', 'maxYear' => (date('Y') - 0)));?>
				</fieldset>
				<fieldset>
				<legend><?php __('Datos'); ?></legend>
				<span><?php echo $this->Form->input('Vehicles.vehicles_types_id',array('label'=> 'Tipo de Vehículo','options'=>$vehicles_type,'type'=>'select','empty'=>'--Seleccione--','class' => 'inputsize', 'tabindex' =>'3'));?></span>
				<span><?php echo $this->Form->input('Vehicles.brands_id' , array('label'=> 'Marca','empty' => '-- Seleccione --','id'=>'brands','class' => 'inputsize', 'tabindex' =>'4'));?></span>
				<span><?php echo $this->Form->input('Vehicles.models_id' , array('label'=> 'Modelo','empty' => '-- Seleccione --','id'=>'models','class' => 'inputsize', 'tabindex' =>'5'));?></span>
				<br/>
				<span style="float: left;"><?php echo $this->Form->input('Vehicles.extranjero' , array('label'=>'Dominio Extranjero','options'=>array('0'=>'No','1'=>'Si'),'type'=>'select','empty'=>'--', 'tabindex' =>'6'));?></span>
				<span><?php echo $this->Form->input('Vehicles.dom_parcial' ,array('label'=>'N° Dominio Completo','options'=>array('0'=>'No','1'=>'Si','2'=>'Ilegible','3'=>'No Posee'),'type'=>'select','empty'=>'--','class' => 'inputsize4', 'tabindex' =>'7', 'onChange' => 'showFields_dominio_completo(this.value)')); ?></span>
				<div id="dominio_completo">
				<span><?php echo $this->Form->input('Vehicles.dominio' ,array('label'=>'Dominio', 'tabindex' =>'8'));?></span>
				</div>
				<span style="float: left;"><?php  echo $this->Form->input('Vehicles.motor_parc' ,array('label'=>'N° Motor Completo','options'=>array('0'=>'No','1'=>'Si','2'=>'Ilegible','3'=>'No Posee'),'type'=>'select','empty'=>'--','class' => 'inputsize4', 'tabindex' =>'9', 'onChange' => 'showFields_motor_completo(this.value)'));?></span>
				<span><?php  echo $this->Form->input('Vehicles.chasis_parc', array('label'=>'N° Chasis Completo','options'=>array('0'=>'No','1'=>'Si','2'=>'Ilegible','3'=>'No Posee'),'type'=>'select','empty'=>'--','class' => 'inputsize4', 'tabindex' =>'10', 'onChange' => 'showFields_chasis_completo(this.value)'));?></span>
				<div id="motor_completo">
				<?php  echo $this->Form->input('Vehicles.nro_motor' ,array('label'=>'N° Motor', 'tabindex' =>'11'));?>
				</div>
				<div id="chasis_completo">
				<?php  echo $this->Form->input('Vehicles.nro_chasis' ,array('label'=>'N° de Chasis', 'tabindex' =>'12'));?>
				</div>
				</fieldset>
				
            </fieldset>
				 
		 </div>
		<div style="padding-left:10px; padding-top:1px; width: 450px; float:left;">
        <fieldset>
		
            <h5 style="margin-top: 0px; margin-bottom: 8px;"><legend><?php __('Datos Judiciales'); ?></legend></h5>
			<span style="padding-left: 60px;">
			 
             <span style="float: left;"><?php echo $this->Form->input('Master.jurisdictions_id',array('id'=>'jurisdictions','empty' => '-- Seleccione --', 'label'=> 'Jurisdicción','class' => 'inputsize', 'tabindex' =>'13'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Master.provinces_id',array('label'=>'Provincia','id'=>'provinces','empty' => '-- Seleccione --','class' => 'inputsize', 'tabindex' =>'14'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Master.charters_id',array('id'=>'charters','empty' => '-- Seleccione --', 'label'=> 'Fuero','class' => 'inputsize', 'tabindex' =>'15'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Master.placements_id',array('id'=>'placements','empty' => '-- Seleccione --', 'label'=> 'Depto. Judicial o Circunscripción','class' => 'inputsize', 'tabindex' =>'16'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Master.courts_id',array('id'=>'courts','empty' => '-- Seleccione --', 'label'=> 'Juzgado','options'=>$courts,'class' => 'inputsize', 'tabindex' =>'17'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Master.secretaries_id',array('id'=>'secretaries','empty' => '-- Seleccione --', 'label'=> 'Secretaría','options'=>$secretary,'class' => 'inputsize', 'tabindex' =>'18'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Causes.police_stations_id',array('empty'=>'--Seleccione--','options'=>$police_stations,'type'=>'select','class' => 'inputsize', 'tabindex' =>'19'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Causes.nro_causa', array('label'=>'Nº de Causa','class' => 'inputsize', 'tabindex' =>'20'));?></span>
             <span style="float: left;"><?php echo $this->Form->input('Causes.descripcion', array('label'=>'Descripción','class' => 'inputsize', 'tabindex' =>'21'));?></span>
			
			</span>
         </fieldset>
	    </div>
		<div style="width: 450px; padding-top:1px; float:left; padding-left: 10px;">

<fieldset>  
        <h5 style="margin-top: 0px; margin-bottom: 8px;"><legend><?php __('Ubicación y Estado'); ?></legend></h5>

        <span style="float: left;"><?php echo $this->Form->input('Master.police_states_id',array('label'=>'Estado','type'=>'select','options'=>$policestates,'empty'=>'--Seleccione--','class' => 'inputsize', 'tabindex' =>'32', 'onChange' => 'showFields(this.value)'));?></span>
        <?php if($session->read('perfil')=='0'){  ?>
        <div id="divout">
		<span style="float: left;"><?php echo $this->Form->input('Master.states_id',array('label'=>'Estado Renvese','options'=>$states,'type'=>'select','empty'=>'--Seleccione--','class' => 'inputsize', 'tabindex' =>'33'));?></span>
        </div>
        <?php } ?>
        <div id="divout">
		<span style="float: left;"><?php echo $this->Form->input('Master.desposits_id',array('label'=>'Depósito','options'=>$desposits,'type'=>'select','empty'=>'--Seleccione--','class' => 'inputsize', 'tabindex' =>'34'));?></span>
        </div>

</fieldset>



	      </div>
		  
		
<div style="width: 450px; padding-top:1px; float:left; padding-left: 10px;">
<?php echo $this->Form->end(__('Buscar', true));
        $options1 = array('url' => 'update_select', 'update' => 'models');
        echo $ajax->observeField('brands', $options1);

        $options2 = array('url' => 'update_jurisdictions', 'update' => 'provinces');
        echo $ajax->observeField('jurisdictions', $options2);

        $options3 = array('url' => 'update_provinces', 'update' => 'charters');
        echo $ajax->observeField('provinces',$options3);
    
        $options4 = array('url' => 'update_placements', 'update' => 'placements');
        echo $ajax->observeField('charters',$options4);
    
        $options5 = array('url' => 'update_courts', 'update' => 'courts');
        echo $ajax->observeField('placements',$options5);
    
        $options6 = array('url' => 'update_secretaries', 'update' => 'secretaries');
        echo $ajax->observeField('courts',$options6);
        ?>
</div>
